import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/layout";

//全局路由:
export const constantRoutes = [
  //登录
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true,
  },
  //404错误
  {
    path: "/404",
    component: () => import("@/views/404"),
    hidden: true,
  },
    //首页
    {
      path: "/",
      component: Layout,
      redirect: "/dashboard",
      children: [
        {
          path: "dashboard",
          name: "Dashboard",
          component: () => import("@/views/dashboard/index"),
          meta: { title: "数据中心", icon: "el-icon-data-line" },
        },
      ],
    },
    //角色管理
    {
      name: "Acl",
      path: "/acl",
      component: Layout,
      redirect: "/acl/user/list",
      meta: {
        title: "权限管理",
        icon: "el-icon-lock",
      },
      children: [
        {
          name: "User",
          path: "user/list",
          component: () => import("@/views/acl/user/list"),
          meta: {
            title: "员工管理",
          },
        },
        {
          name: "Role",
          path: "role/list",
          component: () => import("@/views/acl/role/list"),
          meta: {
            title: "角色管理",
          },
        },
        {
          name: "RoleAuth",
          path: "role/auth/:id",
          component: () => import("@/views/acl/role/roleAuth"),
          meta: {
            activeMenu: "/acl/role/list",
            title: "角色授权",
          },
          hidden: true,
        },
        {
          name: "Permission",
          path: "permission/list",
          component: () => import("@/views/acl/permission/list"),
          meta: {
            title: "菜单管理",
          },
          hidden: false,
        },
      ],
    },
    {
      path: "/member",
      component: Layout,
      name: "member",
      meta: { title: "首页", icon: "el-icon-info" },
      children: [
        {
          path: "salesToday",
          name: "salesToday",
          component: () => import("@/views/editindex/index"),
          meta: { title: "首页编辑" },
        },
      ],
    },
    //预约页面管理
    {
      path: "/CouponEdit",
      component: Layout,
      name: "member",
      meta: { title: "预约页面管理", icon: "el-icon-magic-stick" },
      children: [
        {
          path: "CouponEdit",
          name: "CouponEdit",
          component: () => import("@/views/reservation/reservation"),
          meta: { title: "预约页面管理" },
        },
      ],
    },
    //知识管理
    {
      path: "/contentManagement",
      component: Layout,
      name: "contentManagement",
      meta: { title: "内容管理", icon: "el-icon-edit" },
      children: [
        {
          path: "classCenter",
          name: "classCenter",
          component: () => import("@/views/Test/Test1"),
          meta: { title: "课程中心" },
        },
        {
          path: "classOut",
          name: "classOut",
          component: () => import("@/views/Test/Test2"),
          meta: { title: "内容资讯" },
        },
      ],
    },
   
    //用户管理
    {
      path: "/peopleManagement",
      component: Layout,
      name: "peopleManagement",
      meta: { title: "客户管理", icon: "el-icon-s-check" },
      children: [
        {
          path: "userManagement",
          name: "userManagement",
          component: () => import("@/views/userManagement/parentManagement"),
          meta: { title: "用户管理" },
        },
        {
          path: "teacherManagement",
          name: "teacherManagement",
          component: () => import("@/views/userManagement/teacherManagement"),
          meta: { title: "教师管理" },
        },
      ],
    },
    //学员管理
    {
      path: "/closedCollaboration",
      component: Layout,
      name: "closedCollaboration",
      meta: { title: "学员管理", icon: "el-icon-s-flag" },
      children: [
        {
          path: "sonCollaboration",
          name: "sonCollaboration",
          component: () => import("@/views/cosingAssistance/index"),
          meta: { title: "亲子课设计" },
        },
      ],
    },
    //指导师学员管理
    {
      path: "/comConvention",
      component: Layout,
      name: "comConvention",
      meta: { title: "指导师学员管理", icon: "el-icon-s-platform" },
      children: [
        {
          path: "sonConvention",
          name: "sonConvention",
          component: () => import("@/views/CommunityConvention/index"),
          meta: { title: "亲子手册" },
        },
      ],
    },
    {
      path: "/Activity",
      component: Layout,
      name: "Activity",
      meta: { title: "量化", icon: "el-icon-film" },
      children: [
        {
          path: "sonConvention",
          name: "sonConvention",
          component: () => import("@/views/evaluate/index"),
          meta: { title: "量化指标评估" },
        },]
      
    },
    //会员管理
    {
      path: "/member",
      component: Layout,
      name: "member",
      meta: { title: "会员管理", icon: "el-icon-news" },
      children: [
        {
          path: "membercenter",
          name: "membercenter",
          component: () => import("@/views/member/index"),
          meta: { title: "会员" },
        },
      ],
    },
     //账单管理
     {
      path: "/Order",
      component: Layout,
      name: "Order",
      meta: { title: "账单管理", icon: "el-icon-pie-chart" },
  
      children: [
        {
          path: "OrderList",
          name: "OrderList",
          component: () => import("@/views/check/OrderList"),
          meta: { title: "账单管理" },
        },
      ],
    },
    
    //反馈管理
    {
      path: "/feedback",
      component: Layout,
      name: "feedback",
      meta: { title: "反馈管理", icon: "el-icon-date" },
      children: [
        {
          path: "feedbackall",
          name: "feedbackall",
          component: () => import("@/views/feedback/feedbackall"),
          meta: { title: "功能异常" },
        },
        {
          path: "feedbackproductsuggestion",
          name: "feedbackproductsuggestion",
          component: () => import("@/views/feedback/feedbackproductsuggestion"),
          meta: { title: "产品建议" },
        },
        {
          path: "feedbackViolationreporting",
          name: "feedbackViolationreporting",
          component: () => import("@/views/feedback/feedbackViolationreporting"),
          meta: { title: "违规举报" },
        },
      ],
    },
   
];
//异步路由:
export const asyncRoutes = [

];
//任意路由 错误路由为重定向:
export const anyRoutes = [
  // 404 page must be placed at the end !!!
  { path: "*", redirect: "/404", hidden: true },
];
const createRouter = () =>
  new Router({
    mode: "hash", // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes,
  });

const router = createRouter();

export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
